#!/usr/bin/env bash

set -ve

export LFS='/mnt/lfs'

_USER=`whoami`
if [ "$_USER" != "lfs" ];
then
    echo 'WARNING: User lfs ONLY!!!' && exit;
fi

############################# Findutils #############################

cd $LFS/sources/
tar -xvf findutils-4.6.0.tar.gz
cd findutils-4.6.0/

sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' gl/lib/*.c
sed -i '/unistd/a #include <sys/sysmacros.h>' gl/lib/mountlist.c
echo "#define _IO_IN_BACKUP 0x100" >> gl/lib/stdio-impl.h

./configure --prefix=/tools
make
make check
make install
